<!DOCTYPE html>
<html>
<head>
    <title>模块分类管理</title>
    <include file='public/head'>
        <style>
            table th, table td{text-align: center;}
            .switch-left,.switch-right{
            	width: 30px;height: 34px;display: inline-block;cursor: pointer;font-size: 12px;line-height: 34px;text-align: center;color: white;font-weight: 800;
            	background-color: #ccc;
            }
            .switch-left{
            	/*background-color:#08BC70 ;*/
            	border-radius: 3px 0px 0px 3px;
            	border-right: 1px solid block;
            }
            .switch-right{
            	/*background-color: #ccc;*/
            	border-radius: 0px 3px 3px 0px;
            	border-left: 1px solid block;
            }
            .switch-off{
            	background-color: red;
            }
            .switch-on{
            	background-color: #08BC70 ;
            }
        </style>
</head>
<body>
    <div class="wrap js-check-wrap">
        <ul class="nav nav-tabs">
            <php> $currentTab = 7 ;</php>
	        <include file="public/nav" />
        </ul>
        <div class="rows margin-top-20">
        	<form class="form-horizontal js-ajax-form" method="POST" action="{:cmf_plugin_url('Appmarket://Config/index')}" >
        		<h3>资源文件下载主机地址配置</h3>
        		<hr/>
				<div class="form-group">
					<label for="" class="col-sm-2 control-label">主机地址<span style="color:red;">(主地址)</span></label>
					<div class="col-sm-8">
						<input type="text" class="form-control" name="mainAddress"  value="{$mainAddress.address|default=''}" placeholder="请输入资源文件下载主机地址(主地址)">
						<input type="hidden" name="mainStatus" value="{$mainAddress.status|default=0}">
					</div>
					<div class="col-sm-2">
						<span class="switch-left <?php if($mainAddress['status'] ==1 ) echo 'switch-on' ;?>" data-tag = '1'  data-target='mainStatus' >开</span><span class="switch-right  <?php if($mainAddress['status'] ==0 ) echo 'switch-off' ;?>" data-tag = '0' data-target='mainStatus' >关</span>
					</div>
				</div>
				<div class="form-group">
					<label for="" class="col-sm-2 control-label">主机地址<span style="color:red;">(备用地址)</span></label>
					<div class="col-sm-8">
						<input type="text" class="form-control" name="address"  value="{$address.address|default=''}" placeholder="请输入资源文件下载主机地址(副地址)">
						<input type="hidden" name="status" value="{$address.status|default=0}">
					</div>
					<div class="col-sm-2">
						<span class="switch-left  <?php if($address['status'] ==1 ) echo 'switch-on' ;?>"  data-tag = '1' data-target='status' >开</span><span class="switch-right  <?php if($address['status'] ==0 ) echo 'switch-off' ;?>" data-tag='0' data-target='status' >关</span>
					</div>
				</div>
				<div  class="form-group">
					<label for="" class="col-sm-2 control-label"></label>
					<div class="col-sm-10">
						<if condition="cmf_auth_check(cmf_get_current_admin_id(),'plugin/appmarket/config/saveConfigData')">
							<button class="btn btn-success js-ajax-submit">保存配置</button>
						</if>
					</div>
				</div>
			</form>
        </div>
    </div>
<include file='public/scripts'>
<script src="__STATIC__/js/layer/layer.js"></script>
<script src="__STATIC__/js/custom/custom.js"></script>
<script>
	$('.switch-left').click(function(){
		$( this ).css('backgroundColor' , '#08BC70' );
		$(this).next().css( 'backgroundColor' , '#ccc' );
		let S = $(this).data('tag');
		let ele = $(this).data('target');
		$( 'input[name='+ele+']' ).val( S );
	});
	$('.switch-right').click(function(){
		$( this ).css( 'backgroundColor' , 'red' );
		$(this).prev().css( 'backgroundColor' , '#ccc' );
		let S = $(this).data('tag');
		let ele = $(this).data('target');
		$( 'input[name='+ele+']' ).val( S );
	});

</script>
</body>
</html>